package com.mask.jvm.c5_gc;

import java.util.concurrent.TimeUnit;

/**
 * @author hx
 * @since 2022/1/1 11:21 下午
 */

public class JStackTest {

    public static void main(String[] args) {
        Object lock = new Object();



        synchronized (lock) {
            new Thread(() ->{
                System.out.println(Thread.currentThread().getName()+"嘟嘟嘟");
            },"线程B").start();
        }
        synchronized (lock) {
            new Thread(() ->{
                System.out.println(Thread.currentThread().getName()+"嘟嘟嘟");
            },"线程C").start();
        }

        synchronized (lock) {
            new Thread(() ->{
                try {
                    TimeUnit.DAYS.sleep(1);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println(Thread.currentThread().getName()+"嘟嘟嘟");
            },"线程A").start();
        }
    }
}
